package org.jumiz.dbview.core.controller;

import org.jumiz.dbview.config.R;
import org.jumiz.dbview.core.service.TableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;

@RestController
@RequestMapping("/core")
public class TableController {

    @Autowired
    private TableService tableService;

    @GetMapping("/load")
    public Mono<R.Response> load(Long id, String table) {
        return tableService.load(id, table).map(item -> R.success(item));
    }
}
